package classes.utils
{
	import classes.TreasuryModel;
	
	[Bindable]
	public class Configuration
	{
		//Class to store constants for configuring the application 
		
		public static var toolbarWidth:int 		= 245;
		public static var toolbarChildWidth:int = 221;
		
		public static var dataGridDelColumnWidth:int = 60;
		public static var dataGridDateColumnWidth:int = 120;
		
		public static function loadUserConfiguration(config:XML):void{
			
		}
		
		public static function loadApplicationConfiguration(config:String):Boolean{
			if(config == null || config == "") 
				return false;
				
			var elements:XMLList = new XMLList(config);
			//var elements:XMLList = config.elements();
			
			for(var i:int = 0; i < elements.length(); i++){
				var option:XML = elements[i];
				switch(option.localName().toUpperCase()){
					case "AUTOLOGIN": 
						TreasuryModel.getInstance().loginUser(option.@userName, option.@password); 
						break;
					
					case "USERSFILEKEY":
						TreasuryModel.getInstance().setUserFileKey(option.@key);
				} 
			}
			
			return true;
		}

	}
}